/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agenda.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Ronildo
 */
@Entity
@Table(name = "AM_TB_TIPO_ACES_MEDI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AmTbTipoAcesMedi.findAll", query = "SELECT a FROM AmTbTipoAcesMedi a"),
    @NamedQuery(name = "AmTbTipoAcesMedi.findByCdTipoAcesMedi", query = "SELECT a FROM AmTbTipoAcesMedi a WHERE a.cdTipoAcesMedi = :cdTipoAcesMedi"),
    @NamedQuery(name = "AmTbTipoAcesMedi.findByDsTipoAcesMedi", query = "SELECT a FROM AmTbTipoAcesMedi a WHERE a.dsTipoAcesMedi = :dsTipoAcesMedi")})
public class AmTbTipoAcesMedi implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @Basic(optional = false)
    @Column(name = "CD_TIPO_ACES_MEDI")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "seq_AM_TB_TIPO_ACES_MEDI")
    @SequenceGenerator(name="seq_AM_TB_TIPO_ACES_MEDI", sequenceName = "seq_AM_TB_TIPO_ACES_MEDI")
    private Short cdTipoAcesMedi;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "DS_TIPO_ACES_MEDI")
    private String dsTipoAcesMedi;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cdTipoAcesMedi")
    private Collection<AmTbUsuaSistMedi> amTbUsuaSistMediCollection;

    public AmTbTipoAcesMedi() {
    }

    public AmTbTipoAcesMedi(Short cdTipoAcesMedi) {
        this.cdTipoAcesMedi = cdTipoAcesMedi;
    }

    public AmTbTipoAcesMedi(Short cdTipoAcesMedi, String dsTipoAcesMedi) {
        this.cdTipoAcesMedi = cdTipoAcesMedi;
        this.dsTipoAcesMedi = dsTipoAcesMedi;
    }

    public Short getCdTipoAcesMedi() {
        return cdTipoAcesMedi;
    }

    public void setCdTipoAcesMedi(Short cdTipoAcesMedi) {
        this.cdTipoAcesMedi = cdTipoAcesMedi;
    }

    public String getDsTipoAcesMedi() {
        return dsTipoAcesMedi;
    }

    public void setDsTipoAcesMedi(String dsTipoAcesMedi) {
        this.dsTipoAcesMedi = dsTipoAcesMedi;
    }

    @XmlTransient
    public Collection<AmTbUsuaSistMedi> getAmTbUsuaSistMediCollection() {
        return amTbUsuaSistMediCollection;
    }

    public void setAmTbUsuaSistMediCollection(Collection<AmTbUsuaSistMedi> amTbUsuaSistMediCollection) {
        this.amTbUsuaSistMediCollection = amTbUsuaSistMediCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdTipoAcesMedi != null ? cdTipoAcesMedi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AmTbTipoAcesMedi)) {
            return false;
        }
        AmTbTipoAcesMedi other = (AmTbTipoAcesMedi) object;
        if ((this.cdTipoAcesMedi == null && other.cdTipoAcesMedi != null) || (this.cdTipoAcesMedi != null && !this.cdTipoAcesMedi.equals(other.cdTipoAcesMedi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.agenda.model.entity.AmTbTipoAcesMedi[ cdTipoAcesMedi=" + cdTipoAcesMedi + " ]";
    }
    
}
